<!DOCTYPE html>
<html lang="zh-CN"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>确认订单</title>
    <meta name="keywords" content="确认订单" />
    <meta name="description" content="确认订单" />
    <meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1,minimum-scale=1, user-scalable=no">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="viewport" content="width=device-width,viewport-fit=cover">
    <link th:href="@{/shoppingApi/css/public.css}" rel="stylesheet">
    <link th:href="@{/shoppingApi/css/order.css}" rel="stylesheet">
    <link th:href="@{/shoppingApi/css/weui.min.css}" rel="stylesheet">
    <link th:href="@{/shoppingApi/css/jquery-weui.min.css}" rel="stylesheet">
</head>
<style type="text/css">
    .setAddress  {
        cursor:pointer;
    }
    .setAddressActive{
        cursor:pointer;
    }
</style>
<body>
<div class="main myorder">
    <div class="main_con c323232">
        <!--<p class="order_title pl15 pr15 bgfff ft17 c323232 ftc flex flex-ac">-->
        <!--<img class="back" src="./images/back.png">-->
        <!--<span class="it1">确认订单</span>-->
        <!--</p>-->
        <!--地址-->
        <!--<div class="bgfff">-->
            <!--<div class="address pt25 pb25 pl15 pr15 flex arrow" onclick="setAddress()">-->
                <!--<img class="mt5" id="myaddresslist" th:src="@{/shoppingApi/images/ordercity.png}">-->
                <!--<div id="address" th:if="${directOrderSure.address!=null}" th:data="${directOrderSure.address.id}" class="ft17 c323232 ml10 it1 pr20">-->
                    <!--&lt;!&ndash;<div id="address" th:if="${orderSure.address==null}" data="0" class="ft17 c323232 ml10 it1 pr20">&ndash;&gt;-->
                    <!--<p>-->
                        <!--<span th:if="${directOrderSure.address!=null}" th:text="${directOrderSure.address.name}"></span>-->
                        <!--<span th:if="${directOrderSure.address!=null}" class="ml25" th:text="${directOrderSure.address.phone}"></span>-->
                    <!--</p>-->
                    <!--<p class="ft14 mt10">-->
                        <!--<label>地址：</label>-->
                        <!--<label th:if="${directOrderSure.address!=null}" th:text="${directOrderSure.address.provinceName+directOrderSure.address.cityName+directOrderSure.address.areaName+directOrderSure.address.detailAddr}"></label>-->
                    <!--</p>-->
                <!--</div>-->
                <!--<div id="address1" th:if="${directOrderSure.address==null}" data="0" class="ft17 c969696 ml10 it1 pr20">-->
                    <!--<p>添加地址</p>-->
                <!--</div>-->
            <!--</div>-->
            <!--<img class="w100 db" th:src="@{/shoppingApi/images/line.png}">-->
        <!--</div>-->
        <div class="bgfff moreAddress" th:if="${directOrderSure.addressList!=null}" th:each="model,numis:${directOrderSure.addressList}">
            <!--<div class="address pt25 pb25 pl15 pr15 flex arrow" th:data="${model.id}" onclick="setAddress(this)">-->
            <div class="address pt25 pb25 pl15 pr15 flex arrow setAddress" th:isMoreAddress="${directOrderSure.isMoreAddress}" th:data="${model.id}">
                <img class="mt5" id="myaddresslist" th:src="@{/shoppingApi/images/ordercity.png}">
                <div id="address" th:if="${directOrderSure.address!=null}" th:data="${model.id}" class="ft17 c323232 ml10 it1 pr20">
                    <!--<div id="address" th:if="${orderSure.address==null}" data="0" class="ft17 c323232 ml10 it1 pr20">-->
                    <p>
                        <span th:if="${directOrderSure.address!=null}" th:text="${model.name}"></span>
                        <span th:if="${directOrderSure.address!=null}" class="ml25" th:text="${model.phone}"></span>
                    </p>
                    <p class="ft14 mt10">
                        <label>地址：</label>
                        <label th:if="${directOrderSure.address!=null}" th:text="${model.provinceName+model.cityName+model.areaName+model.detailAddr}"></label>
                    <!--<input th:if="${directOrderSure.isMoreAddress==1&&numis.index==0}" type="number" min="1" th:value="${directOrderSure.addressCount}" class="pradnumber" style="width: 40px;float: right">-->
                        <!--<input th:if="${directOrderSure.isMoreAddress==1&&numis.index!=0}" type="number" min="1" value="0" class="pradnumber" style="width: 40px;float: right">-->
                    <!--<label th:if="${directOrderSure.isMoreAddress==1}"  class="" style="margin-left: 5px;float: right">数量：</label>-->
                    </p>
                </div>
            </div>
            <img class="w100 db" th:src="@{/shoppingApi/images/line.png}">
        </div>
        <div class="bgfff moreAddress" th:if="${directOrderSure.address==null||directOrderSure.address.id==null}">
            <div class="address pt25 pb25 pl15 pr15 flex arrow setAddress" th:isMoreAddress="${directOrderSure.isMoreAddress}">
                <img class="mt5" id="myaddresslist" th:src="@{/shoppingApi/images/ordercity.png}">
                <div id="address1"   data="0" class="ft17 c969696 ml10 it1 pr20">
                    <p>添加地址</p>
                </div>
            </div>
            <img class="w100 db" th:src="@{/shoppingApi/images/line.png}">
        </div>

        <!--<div th:if="${directOrderSure.isMoreAddress==1}" class="setAddressActive mt15 pl15 pr15 shopmoney ft15 c323232 heigth45 bgfff flex flex-pj">-->
            <!--<span>活动产品有需要可添加多个地址发货</span>-->
        <!--</div>-->
        <div class="mt15">
            <p class="shop flex flex-ac pl15 bgfff">
                <img th:src="@{/shoppingApi/images/carttip.png}" >
                <span class="ml15 ft17 c323232">新零售微店</span>
            </p>
        </div>
        <input type="hidden" id="isMoreAddress" th:data="${directOrderSure.isMoreAddress}">
        <input type="hidden" id="addressCount" th:data="${directOrderSure.addressCount}">
        <div class="mb15">
            <div class="mb15 bgfff goodcon" goodid="6" th:each="model:${directOrderSure.productInfo}">
                <div class="pl15 pr15 pt10 pb10 flex">
                    <a class="db pic ml15 mb10">
                        <img class="w100" th:src="${'http://xlspic.ycsqd.com'+model.imgUrl}">
                    </a>
                    <div class="it1 ml15">
                        <p class="ft17 c323232 mt5" style="font-weight: bold" th:text="${model.productName}"></p>
                        <p class="ft14 c323232 mt5" th:text="${model.productDesc}"></p>
                        <p class="cf70029 mt5">
                            <!--<span class="ft14">￥</span>-->
                            <span class="ft17 product-price" th:text="${'￥'+model.productPrice}"></span>
                        </p>
                    </div>
                </div>
                <p class="changenum pl15 pr15 ft17 c323232">
                    <span class="fl">购买数量</span>
                    <span class="fr">
                <span th:data="${model.shoppingId}" class="count">-</span>
                <span class="number">
                    <input type="number" th:guigeid="${model.guigeId}" th:data="${model.shoppingId}" th:value="${model.productCount}" th:price="${model.productPrice}" th:datarealpay="${directOrderSure.realPay}" th:datafreight="${directOrderSure.freight}" class="goodtype productCount">
                </span>
                <span th:data="${model.shoppingId}"  class="add">+</span>
            </span>
                </p>
            </div>

            <div class="mt15 pl15 pr15 shopmoney ft15 c323232 heigth45 bgfff flex flex-pj">
                <span>商品金额</span>
                <span><span>￥</span><span class="money1">0.00</span></span>
            </div>

            <div class="mt15 quan bgfff">
                <div class="pl15 pr15 ft17 c646464 overflow rela ">
                    <div class="quans flex flex-pj flex-ac">
                        <p class="it1">
                            <span class="db" th:text="${'可用'+directOrderSure.WebConfig.finacename2}"></span>
                            <span class="ft12 c969696" th:text="${'(您当前共有￥'+directOrderSure.avgCoupon+directOrderSure.WebConfig.finacename2+')'}"></span>
                        </p>
                        <!--<p th:text="${directOrderSure.couponAll+'-&#45;&#45;'+directOrderSure.avgCoupons}"></p>-->
                        <span class="fr ft14 mr10" data="1" th:title="${'-￥'+#numbers.formatDecimal(directOrderSure.couponAll, 1, 2)+directOrderSure.WebConfig.finacename2}" th:id="'spcoupon'+${directOrderSure.count}" th:if="${directOrderSure.couponAll<directOrderSure.avgCoupons}" th:text="${'-￥'+#numbers.formatDecimal(directOrderSure.couponAll, 1, 2)+directOrderSure.WebConfig.finacename2}" th:coupon="${#numbers.formatDecimal(directOrderSure.couponAll, 1, 2)}"></span>
                        <span class="fr ft14 mr10" data="1" th:title="${'-￥'+#numbers.formatDecimal(directOrderSure.avgCoupons, 1, 2)+directOrderSure.WebConfig.finacename2}" th:id="'spcoupon'+${directOrderSure.count}" th:if="${directOrderSure.couponAll>=directOrderSure.avgCoupons}" th:text="${'-￥'+#numbers.formatDecimal(directOrderSure.avgCoupons, 1, 2)+directOrderSure.WebConfig.finacename2}" th:coupon="${#numbers.formatDecimal(directOrderSure.avgCoupons, 1, 2)}"></span>
                        <!--<span class="fr ft14 mr10" data="1" th:title="${'-￥0.00'+directOrderSure.WebConfig.finacename2}" th:id="'spcoupon'+${directOrderSure.count}" th:if="${directOrderSure.avgCoupons==0}" th:text="${'-￥0.00'+directOrderSure.WebConfig.finacename2}" th:coupon="${'0.00'}"></span>-->
                        <!--<span class="fr ft14 mr10" data="1" th:title="${'-￥'+directOrderSure.avgCoupon+directOrderSure.WebConfig.finacename2}" th:id="'spcoupon'+${directOrderSure.count}"  th:if="${directOrderSure.realCashCouponAll>directOrderSure.avgCoupons}" th:text="${'-￥'+directOrderSure.avgCoupon+directOrderSure.WebConfig.finacename2}"th:coupon="${#numbers.formatDecimal(directOrderSure.avgCoupon, 1, 2)}"></span>-->
                    </div>
                    <!--券信息弹窗-->
                    <div class="quan_alert c323232" style="display: none">
                        <div class="quan_con bgfff">
                            <!--<p class="ft17 c323232 ftc mb10" th:text="${directOrderSure.WebConfig.finacename2}"></p>-->
                            <!--<p class="ft15 c323232 pb25 ftc">-->
                                <!--该订单最多可使用-->
                                <!--<span class="bold" th:id="${'maxcoupon'+directOrderSure.count}" th:text="${'￥'+directOrderSure.couponAll}"></span>-->
                                <!--<i th:text="${directOrderSure.WebConfig.finacename2}"></i>-->
                            <!--</p>-->
                            <!--<div class="flex flex-pj flex-ac mb15">-->
                                <!--<div>-->
                                    <!--<p class="db">-->
                                        <!--<span class="ft17 c000"><i th:text="${'使用'+directOrderSure.WebConfig.finacename2}"></i></span><span class="ft10 cf70029">(抵扣)</span>-->
                                    <!--</p>-->
                                    <!--<p class="ft10 c000 mt5" th:text="${'(您当前共有￥'+directOrderSure.avgCoupon+directOrderSure.WebConfig.finacename2+')'}"></p>-->
                                <!--</div>-->
                                <!--<div>-->
                                    <!--<span class="ft17 cf70029 mr10" th:if="${directOrderSure.avgCoupons>directOrderSure.couponAll}" th:text="${'-￥'+#numbers.formatDecimal(directOrderSure.couponAll, 1, 2)+directOrderSure.WebConfig.finacename2}" th:id="'spcouponli'+${directOrderSure.count}"></span>-->
                                    <!--<span class="ft17 cf70029 mr10" th:if="${directOrderSure.avgCoupons<directOrderSure.couponAll}" th:text="${'-￥'+(directOrderSure.avgCoupon)+directOrderSure.WebConfig.finacename2}" th:id="'spcouponli'+${directOrderSure.count}"></span>-->
                                    <!--<input type="checkbox" th:info="${directOrderSure.WebConfig.finacename2}" th:data="${directOrderSure.count}"  th:id="${directOrderSure.count}" th:value="${directOrderSure.WebConfig.finacename2}" onclick="CheckD(this,1);" checked="checked" name="let">-->
                                <!--</div>-->
                            <!--</div>-->
                            <!--<p class="ft17 cfff close ftc bgf70029">关闭</p>-->
                        </div>
                    </div>
                </div>

                <!--////////-->
                <div class="pl15 pr15 ft17 c646464 overflow rela ">
                    <div class="quans flex flex-pj flex-ac">
                        <p class="it1">
                            <span class="db"  th:text="${'可用'+directOrderSure.WebConfig.finacename3}"></span>
                            <span class="ft12 c969696" th:text="${'(您当前共有￥'+directOrderSure.avgCashCoupon+directOrderSure.WebConfig.finacename3+')'}"></span>
                        </p>
                        <!--<p th:text="${directOrderSure.avgCashCoupons+'-&#45;&#45;'+directOrderSure.realCashCouponAll}"></p>-->

                        <span class="fr ft14 mr10" data="1" th:title="${'-￥'+#numbers.formatDecimal(directOrderSure.realCashCouponAll, 1, 2)+directOrderSure.WebConfig.finacename3}"  th:id="'spcashcoupon'+${directOrderSure.count}"  th:if="${directOrderSure.avgCashCoupons>=directOrderSure.realCashCouponAll}" th:text="${'-￥'+#numbers.formatDecimal(directOrderSure.realCashCouponAll, 1, 2)+directOrderSure.WebConfig.finacename3}" th:cashcoupon="${#numbers.formatDecimal(directOrderSure.realCashCouponAll, 1, 2)}"></span>
                        <span class="fr ft14 mr10" data="1" th:title="${'-￥'+(directOrderSure.avgCashCoupon)+directOrderSure.WebConfig.finacename3}" th:id="'spcashcoupon'+${directOrderSure.count}"  th:if="${directOrderSure.avgCashCoupons<directOrderSure.realCashCouponAll}" th:text="${'-￥'+(directOrderSure.avgCashCoupon)+directOrderSure.WebConfig.finacename3}" th:cashcoupon="${#numbers.formatDecimal(directOrderSure.avgCashCoupon, 1, 2)}"></span>
                        <!--<span class="fr ft14 mr10" data="1" th:title="${'-￥0.00'+directOrderSure.WebConfig.finacename3}" th:id="'spcashcoupon'+${directOrderSure.count}"  th:if="${directOrderSure.avgCashCoupons==0}" th:text="${'-￥0.00'+directOrderSure.WebConfig.finacename3}" th:cashcoupon="${0.00}"></span>-->
                    </div>
                    <!--券信息弹窗-->
                    <div class="quan_alert c323232" style="display: none">
                        <div class="quan_con bgfff">
                            <!--<p class="ft17 c323232 ftc mb10" th:text="${directOrderSure.WebConfig.finacename3}"></p>-->
                            <!--<p class="ft15 pl25 mb10">当前等级<span class="bold" th:text="${'（'+directOrderSure.WebConfig.finacename3+'）'}"></span></p>-->
                            <!--<p class="ft15 pl25 mb10">该订单最多可用-->
                                <!--<span class="bold" th:id="${'maxcashcoupon'+directOrderSure.count}"  th:text="${'￥'+directOrderSure.realCashCouponAll}"></span>-->
                                <!--<i th:text="${directOrderSure.WebConfig.finacename3}"></i>-->
                            <!--</p>-->
                            <!--<div class="flex flex-pj flex-ac">-->
                                <!--<div>-->
                                    <!--<p>-->
                                        <!--<span class="ft17 c000" th:text="${'使用'+directOrderSure.WebConfig.finacename3}"></span>-->
                                        <!--<span class="ft10 cf70029">(抵扣)</span>-->
                                    <!--</p>-->
                                    <!--<p class="ft10 c000 mt5" th:text="${'(您当前共有￥'+directOrderSure.avgCashCoupon+directOrderSure.WebConfig.finacename3+')'}"></p>-->
                                <!--</div>-->
                                <!--<div>-->
                                    <!--<span class="ft17 cf70029 mr10" th:id="${'spcashcouponli'+directOrderSure.count}" th:if="${directOrderSure.avgCashCoupons>directOrderSure.realCashCouponAll}" th:text="${'-￥'+directOrderSure.realCashCouponAll+directOrderSure.WebConfig.finacename3}"></span>-->
                                    <!--<span class="ft17 cf70029 mr10" th:id="${'spcashcouponli'+directOrderSure.count}" th:if="${directOrderSure.avgCashCoupons<directOrderSure.realCashCouponAll}" th:text="${'-￥'+directOrderSure.avgCashCoupon+directOrderSure.WebConfig.finacename3}"></span>-->
                                    <!--<input type="checkbox" th:info="${directOrderSure.WebConfig.finacename3}"  th:id="${directOrderSure.count}" th:data="${directOrderSure.count}" onclick="CheckD(this,2);"  checked="checked" name="let">-->
                                <!--</div>-->
                            <!--</div>-->
                            <!--<div class="ft14 c969696 ftc bgf0f0f0">-->
                                <!--<p class="pb15 heigth45  ftl bgfff pl15 pr15">用户等级使用<i th:text="${directOrderSure.WebConfig.finacename3}"></i>抵扣该订单说明：</p>-->
                                <!--<p class="pad15 overflow">-->
                                    <!--<span class="fl">游客</span>-->
                                    <!--<span class="fr">￥10</span></p>-->
                                <!--<p class="pb15 c323232 overflow pl15 pr15">-->
                                    <!--<span class="fl">会员</span>-->
                                    <!--<span class="fr">￥30</span></p>-->
                                <!--<p class="pb15 overflow pl15 pr15">-->
                                    <!--<span class="fl">店主</span>-->
                                    <!--<span class="fr">￥40</span></p>-->
                                <!--<p class="pb15 overflow pl15 pr15">-->
                                    <!--<span class="fl">优质店主</span>-->
                                    <!--<span class="fr">￥55</span></p>-->
                            <!--</div>-->
                            <!--<p class="ft17 cfff close ftc bgf70029">关闭</p>-->
                        </div>
                    </div>
                </div>
                <div class="pl15 pr15 ft17 c646464 overflow rela">
                    <div class="quans flex flex-pj flex-ac">
                        <p class="it1">
                            <span class="db">会员节省</span>
                        </p>
                        <span class="fr ft14 mr10 memberSave" th:text="${'-￥'+#numbers.formatDecimal(directOrderSure.memberSave, 1, 2)}"></span>
                    </div>
                </div>
            </div>
        </div>

        <p class="heigth45 mt15 pl15 pr15 bgfff overflow ft17 c323232">
            <span class="fl">配送费</span>
            <span class="fr ft14 freight" th:text="${'+￥'+#numbers.formatDecimal(directOrderSure.freight, 1, 2)}"></span>
        </p>
        <div>
            <!--<p class="heigth45 mt15 pl15 pr15 bgfff overflow ft17 c323232 flex mess">-->
                <!--<span>买家留言：</span>-->
                <!--<span class="it1">-->
                <!--<input class="w100" type="text" placeholder="选填 建议留言前先与商家沟通协定">-->
            <!--</span>-->
            <!--</p>-->
            <p class="total c323232 bgfff ftr pr15">
                <span class="ft17 mr15">
                                        共
                    <span class="totalnum vab" th:text="${directOrderSure.productNumber}">0</span>
                    件
                </span>
                <span class="ft14 ml15">小计
                    <span class="cf70029">￥</span>
                    <span class="cf70029 mr15 money xc" th:text="${#numbers.formatDecimal((directOrderSure.realPay+directOrderSure.freight), 1, 2)}"></span>
                </span>
            </p>
        </div>
        <div class="fixedBox50">
            <div class="fixed-bottom flex flex-col flex-pe">
                <div class="mt15 othermess">
                    <p class="heigth45 ftc ft17 cfff bgff99aa" th:if="${directOrderSure.WebConfig.cashcouponmul!=0}" th:text="${'该单可返￥'+(#numbers.formatDecimal((directOrderSure.realPay*2), 1, 2))+directOrderSure.WebConfig.finacename3}"></p>
                    <p class="pl15 pr15 ftl ft14 ccb3724 bgf8d598 pt5 pb5 bottom_address hide" id="xkadid" th:xkadid="${directOrderSure.address.id}" th:if="${directOrderSure.address!=null&&directOrderSure.address.id!=null}" th:text="${'送至'+directOrderSure.address.provinceName+directOrderSure.address.cityName+directOrderSure.address.areaName+directOrderSure.address.detailAddr}"></p>
                </div>
                <div class="flex flex-pj flex-ac bgfff put">
            <span class="it1 c323232 ft17">
                <!--<span class="ml15  totalnum" th:text="${'共'+directOrderSure.productNumber+'件，总金额'}"></span>-->

                       <span class="ft17 mr15">
                                        共
                    <span class="totalnum vab" th:text="${directOrderSure.productNumber}">0</span>
                    件
                </span>

                <span class="cf70029">￥</span>
                <span class="ft20 cf70029  money xc" th:text="${#numbers.formatDecimal((directOrderSure.realPay+directOrderSure.freight), 1, 2)}"></span>
            </span>
                    <span class="putin ftc" th:backCashCoupon="${directOrderSure.backCashCoupon}" th:memberSave="${directOrderSure.memberSave}" th:freight="${directOrderSure.freight}" th:realPay="${#numbers.formatDecimal((directOrderSure.realPay), 1, 2)}" th:data="${directOrderSure.cartIds}" th:count="${directOrderSure.count}">提交订单</span>
                </div>
            </div>
        </div>
    </div>
</div>
<!--快速导航-->
<div class="mini-mask"></div>
<div class="mini-btn"></div>
<div class="mini-nav">
    <ul>
        <li><a href="/">
            <h5>首页</h5>
        </a></li>
        <li><a href="/wap/selectProductYJAndRjClassfy">
            <h5>分类</h5>
        </a></li>
        <li><a href="javascript:sharebtn()">
            <h5>分享</h5>
        </a></li>
        <li><a href="/wap/openUserCenter">
            <h5>个人中心</h5>
        </a></li>
        <li><a href="javascript:alert('敬请期待...')">
            <h5>店铺</h5>
        </a></li>
        <li><a href="/wap/getCartList">
            <h5>购物车</h5>
        </a></li>
        <li><a href="javascript:alert('敬请期待...')">
            <h5>联系客服</h5>
        </a></li>
    </ul>
</div>
<div id="mini-popup" class="weui-popup__container popup-bottom">
    <div class="weui-popup__overlay"></div>
    <div class="weui-popup__modal share-layer">
        <p class="flex mt20 mb20 flex-ac pl15 pr15">
            <span class="ml20 mr20 it1 lineh1"></span>
            <span class="ft14 c323232">分享到</span>
            <span class="ml20 mr20 it1 lineh1"></span>
        </p>
        <ul class="overflow ft14 c323232 ftc">
            <li id="miniShareMessage">
                <img class="wxhaoyou" th:src="@{/shoppingApi/images/share1.png}">
                <p class="mt10 ">微信好友</p>
            </li>
            <li id="miniShareTimeline">
                <img th:src="@{/shoppingApi/images/share2.png}">
                <p class="mt10">朋友圈</p>
            </li>
        </ul>
        <img class="close close-popup" th:src="@{/shoppingApi/images/close3.png}">
    </div>
</div>
<!--/快速导航-->
</body>
<script th:src="@{/shoppingApi/js/jquery-3.3.1.min.js}"></script>
<script th:src="@{/shoppingApi/js/common.js}"></script>
<script th:src="@{/shoppingApi/js/jquery-weui.min.js}"></script>
<script type="text/javascript" th:src="@{/shoppingApi/js/plusShare.js}"></script>
<script th:src="@{/shoppingApi/js/mininav.js}"></script>
<script type="text/javascript">
    $(function() {
        $(document).on('click', '.setAddress', function(e) {
            if (!$(e.target).is('.pradnumber')) {
                 var isMoreAddress = parseInt($.trim($("#isMoreAddress").attr('data')));
                 var addressCount = parseInt($.trim($("#addressCount").attr('data')));
                 var divcount = $(".moreAddress").length;//

                var redirection = encodeURIComponent(location.href);
                window.location.href = '/wap/myAddress?updateAddressURL=' + redirection+"&isMoreAddress=0";
                //alert(isMoreAddress);
                //return;
                // var redirection = encodeURIComponent(location.href);
                // location.href = '/wap/myAddress?updateAddressURL='+redirection;
            }
        });
        $(document).on('click', '.setAddressActive', function(e) {
                var isMoreAddress = parseInt($.trim($("#isMoreAddress").attr('data')));
                var addressCount = parseInt($.trim($("#addressCount").attr('data')));
                var divcount = $(".moreAddress").length;//

                var redirection = encodeURIComponent(location.href);
            window.location.href = '/wap/myAddress?updateAddressURL=' + redirection+"&isMoreAddress="+isMoreAddress;
                //alert(isMoreAddress);
                //return;
                // var redirection = encodeURIComponent(location.href);
                // location.href = '/wap/myAddress?updateAddressURL='+redirection;
        });
        // $(document).on('click', '.pradnumber', function(e) {
        //    var ss= checknumber();
        // });
        // $('.pradnumber').blur(function (i,item) {
        //    var ss= checknumber();
        // });
    });
    var checkstate=true;
    function checknumber() {
        var numbers=0;
        var productCount= parseInt($.trim($(".goodtype").val()));
        var isMoreAddress=parseInt($.trim($("#isMoreAddress").attr('data')));
        var addressCount=parseInt($.trim($("#addressCount").attr('data')));
        $(".main_con .moreAddress").each(function (i,item) {
            var obj=$(this);
            numbers +=parseInt($.trim(obj.find('.pradnumber').val()));
        });
        var allnumber=productCount*addressCount;
        if(isMoreAddress==1){
            // if(allnumber!=numbers){
            //     $.toast('活动地址产品总数量有误!', 'text');
            //     checkstate=false;
            //     return false;
            // }else {
            //     checkstate=true;
            // }
        }
    }
    function CheckD(obj,type) {
        var count=$(obj).attr('data');
        var info=$(obj).attr('info');
        var title1=$('#spcoupon'+count).attr('title');
        var title2=$('#spcashcoupon'+count).attr('title');
        if(type==1){
            if($(obj).is(":checked")){
                $('#spcoupon'+count).attr('data',1)
                $('#spcoupon'+count).html(title1);
            }
            else{
                $('#spcoupon'+count).attr('data',0)
                $('#spcoupon'+count).attr('checked',false);
                $('#spcoupon'+count).html("-￥0.00"+info);
            }
        }
        if(type==2){
            if($(obj).is(":checked")){
                $('#spcashcoupon'+count).attr('data',1)
                $('#spcashcoupon'+count).html(title2);
            }
            else{
                $('#spcashcoupon'+count).attr('data',0)
                $('#spcashcoupon'+count).attr('checked',false)
                $('#spcashcoupon'+count).html("-￥0.00"+info);
            }
        }
    }
    // 修改地址
    function setAddress () {
        var isMoreAddress=parseInt($.trim($("#isMoreAddress").attr('data')));
        var addressCount=parseInt($.trim($("#addressCount").attr('data')));
        var divcount=$(".moreAddress").length;//
        if(divcount<addressCount){
            var redirection = encodeURIComponent(location.href);
            location.href = '/wap/myAddress?updateAddressURL='+redirection;
        }
        //alert(isMoreAddress);
        //return;
        // var redirection = encodeURIComponent(location.href);
        // location.href = '/wap/myAddress?updateAddressURL='+redirection;
    }
    /*返回上一页*/
    $(".back").on('click',function () {
        window.history.back(-1);
    })
    /*提交订单*/
    $(".putin").on('click',function () {
       checknumber();
        if(checkstate==false){
            return;
        }
        var addressStr="";
        $(".moreAddress").each(function (i,item) {
            //alert($('.moreAddress').length);
            var objs=$(this);
            // var divcount=parseInt($('.moreAddress').length);
            var adid=objs.find('.address').attr('data');
            var adnumber=objs.find('.pradnumber').val();
            // if(i==0){
            //     addressStr +=adid+","+adnumber;
            // }else {
            //     addressStr +=";"+adid+","+adnumber;
            // }
        })
        // if (addressStr=="") {
        //     $.toast('收货地址不能为空!', 'text');
        //     return;
        // }
        var ids=$.trim($(this).attr('data'));
        var realPay=$.trim($(this).attr('realPay'));
        var freight=$.trim($(this).attr('freight'));
        var memberSave=$.trim($(this).attr('memberSave'));
        var addressId=$.trim($("#xkadid").attr('xkadid'));
        var spcoupon=$.trim($('#spcoupon'+$(this).attr('count')).attr('data'));
        var spcashcoupon=$.trim($('#spcashcoupon'+$(this).attr('count')).attr('data'));
        var backCashCoupon=$.trim($(this).attr('backCashCoupon'));
        var coupon=0.00;
        var cashcoupon=0.00;
        //alert(memberSave);return;
        if (!addressId) {
            $.toast('收货地址不能为空', 'text');
            return;
        }
        // alert("addressid:"+addressId+" addressstr："+addressStr);
        // return;
        if(spcoupon==1)
        {
            coupon=$('#spcoupon'+$(this).attr('count')).attr('coupon');
        }
        if(spcashcoupon==1)
        {
            cashcoupon=$('#spcashcoupon'+$(this).attr('count')).attr('cashcoupon');
        }
         //alert(coupon+"---"+cashcoupon);return;
        //加入购物车
        $.ajax({
            url: '/wap/addOrder',
            //type: 'post',
            data:{
                carts:ids,
                addressId:addressId,
                addressStr:addressStr,
                coupon:coupon,
                cashcoupon:cashcoupon,
                realPay:realPay,
                freight:freight,
                memberSave:memberSave,
                backCashCoupon:backCashCoupon
            },
            dataType: 'json',
            contentType: 'application/json',
            async: false,
            success: function(data){
                //alert(JSON.stringify(data));
                if(data.msgCode=="000000"){
                    window.location.href="/wap/payOrder?No="+data.data;
                }else if(data.data=="-2"){
                    $.toast("登录超时请重新登录!",1000, function() {
                        window.location.href="/wap/openUserCenter";
                    });
                }else if(data.data=="-1"){
                    $.toast("购物车数据有误,生成失败!",1000, function() {
                        //window.location.href="/wap/openUserCenter";
                    });
                }else if(data.data=="-3"){
                    $.toast("当前产品限购数量1次,生成失败!",1000, function() {
                        //window.location.href="/wap/openUserCenter";
                    });
                }else if(data.data=="-5"){
                    $.toast("当前产品不支持发往该地址,生成失败!",1000, function() {
                        //window.location.href="/wap/openUserCenter";
                    });
                }else
                {
                    $.toast("生成失败", 'cancel');
                }
            }
        });
    })
    //更新购物车
    function setValue(shoppingId,value) {
        var res=0;
        $.ajax({
            url: '/updateCart?shoppingId='+shoppingId+"&number="+value,
            type: 'post',
            dataType: 'json',
            contentType: 'application/json',
            async: false,
            success: function(data){
                if(data.data>0)
                {
                    res=data.data;
                }
            }
        });
        return res;
    }

    /*修改数量*/
    $(".changenum .add").on('click',function () {
        var numbervalue=$.trim(Number($(this).parent().find(":input[type='number']").val()))==""?0:$.trim(Number($(this).parent().find(":input[type='number']").val()));
        var newval =parseInt(numbervalue) +1;
        var cartId=$(this).attr('data');
        //var productCount= parseInt($.trim($(".goodtype").val()));
        var guigeid=parseInt($.trim($(".goodtype").attr('guigeid')));
        var isMoreAddress=parseInt($.trim($("#isMoreAddress").attr('data')));
        if(isMoreAddress==1){
            if(guigeid==505){
                if(newval>1){
                    $.toast("当前产品单次限购数量1!",1000, function() {
                    });
                    return;
                }
            }
        }

        //提交
        $.ajax({
            url: '/wap/setCartNumber?shoppingId='+cartId+"&number="+newval,
            //type: 'post',
            dataType: 'json',
            contentType: 'application/json',
            async: false,
            success: function(data){
                //console.log(JSON.stringify(data));//return;
                $(".putin").attr("memberSave",data.memberSave);
                $(".putin").attr("backCashCoupon",data.backCashCoupon);
                $(".putin").attr("freight",data.freight);
                $(".putin").attr("realPay",data.realPay);
                $(".putin").attr("count",data.count);
                $(".memberSave").html('-￥'+data.memberSave.toFixed(2));
                $(".freight").html('-￥'+data.freight.toFixed(2));
                    $(".goodtype").attr("datarealpay",data.realPay);
                $(".goodtype").attr("datafreight",data.freight);
                $(data.productInfo).each(function (i,item) {
                    if(i==0){
                        $(".goodtype").val(item.productCount);
                    }
                    /*avgCoupons:可用购物券      Double couponS=0.00;//总的购物换券*/
                    /*avgCashCoupon可用代金券*/
                    //alert(data.avgCashCoupon);
                    $('#maxcoupon'+data.count).html(data.couponAll);
                    if(data.couponAll<data.avgCoupons){
                        console.log("1");
                        $('#spcoupon'+data.count).attr('coupon',data.couponAll)
                        // $('#spcoupon'+data.count).attr('title','-￥'+data.couponAll.toFixed(2)+data.WebConfig.finacename2);
                        // $("#spcoupon"+data.count).html('-￥'+data.couponAll.toFixed(2)+data.WebConfig.finacename2);
                        $('#spcoupon'+data.count).attr('title','-￥'+data.couponAll+data.WebConfig.finacename2);
                        $("#spcoupon"+data.count).html('-￥'+data.couponAll+data.WebConfig.finacename2);
                    }
                    else if(data.realCashCouponAll>data.avgCoupons){
                        console.log("2");
                        $('#spcoupon'+data.count).attr('coupon',data.avgCoupon)
                        // $('#spcoupon'+data.count).attr('title','-￥'+data.avgCoupon.toFixed(2)+data.WebConfig.finacename2);
                        // $("#spcoupon"+data.count).html('-￥'+data.avgCoupon.toFixed(2)+data.WebConfig.finacename2);
                        $('#spcoupon'+data.count).attr('title','-￥'+data.avgCoupon+data.WebConfig.finacename2);
                        $("#spcoupon"+data.count).html('-￥'+data.avgCoupon+data.WebConfig.finacename2);
                    }
                    if(data.avgCoupons>data.couponAll){
                        console.log("3");
                        // $("#spcouponli"+data.count).html('-￥'+data.couponAll.toFixed(2)+data.WebConfig.finacename2);
                        $("#spcouponli"+data.count).html('-￥'+data.couponAll+data.WebConfig.finacename2);
                    }
                    else if(data.avgCoupons<data.couponAll){
                        console.log("4");
                        // $("#spcouponli"+data.count).html('-￥'+data.avgCoupon.toFixed(2)+data.WebConfig.finacename2);
                        $("#spcouponli"+data.count).html('-￥'+data.avgCoupon+data.WebConfig.finacename2);
                    }
                    $('#maxcashcoupon'+data.count).html(data.realCashCouponAll);
                    if(data.avgCashCoupons>data.realCashCouponAll){
                        console.log("5");
                        $('#spcashcoupon'+data.count).attr('cashcoupon',data.realCashCouponAll)
                        // $('#spcashcoupon'+data.count).attr('title','-￥'+data.realCashCouponAll.toFixed(2)+data.WebConfig.finacename3);
                        // $("#spcashcoupon"+data.count).html('-￥'+data.realCashCouponAll.toFixed(2)+data.WebConfig.finacename3);
                        $('#spcashcoupon'+data.count).attr('title','-￥'+data.realCashCouponAll+data.WebConfig.finacename3);
                        $("#spcashcoupon"+data.count).html('-￥'+data.realCashCouponAll+data.WebConfig.finacename3);
                    }
                    else if(data.avgCashCoupons<data.realCashCouponAll){
                        console.log("6");
                        $('#spcashcoupon'+data.count).attr('cashcoupon',data.avgCashCoupon)
                        $('#spcashcoupon'+data.count).attr('title','-￥'+data.avgCashCoupon+data.WebConfig.finacename3);
                        $("#spcashcoupon"+data.count).html('-￥'+data.avgCashCoupon+data.WebConfig.finacename3);
                    }
                    if(data.avgCashCoupons>data.realCashCouponAll){
                        console.log("7");
                        $("#spcashcouponli"+data.count).html('-￥'+data.realCashCouponAll+data.WebConfig.finacename3);
                    }
                    else if(data.avgCashCoupons<data.realCashCouponAll){
                        console.log("8");
                        $("#spcashcouponli"+data.count).html('-￥'+data.avgCashCoupon+data.WebConfig.finacename3);
                    }
                });
            }
        });

        //
        $(this).parent().find(":input[type='number']").val(newval)
        numtotal();
    })
    $(".changenum .count").on('click',function () {
        var numbervalue=$.trim(Number($(this).parent().find(":input[type='number']").val()))==""?0:$.trim(Number($(this).parent().find(":input[type='number']").val()));
        numbervalue =parseInt(numbervalue);
        if(numbervalue>1){
            var newval = numbervalue -1;
            var cartId=$(this).attr('data');
            //提交
            $.ajax({
                url: '/wap/setCartNumber?shoppingId='+cartId+"&number="+newval,
                //type: 'post',
                dataType: 'json',
                contentType: 'application/json',
                async: false,
                success: function(data){
                    //console.log(JSON.stringify(data));
                    $(".putin").attr("memberSave",data.memberSave);
                    $(".putin").attr("backCashCoupon",data.backCashCoupon);
                    $(".putin").attr("freight",data.freight);
                    $(".putin").attr("realPay",data.realPay);
                    $(".putin").attr("count",data.count);
                    $(".memberSave").html('-￥'+data.memberSave.toFixed(2));
                    $(".freight").html('-￥'+data.freight.toFixed(2));
                    $(".goodtype").attr("datarealpay",data.realPay);
                    $(".goodtype").attr("datafreight",data.freight);
                    $(data.productInfo).each(function (i,item) {
                        //alert(data.avgCashCoupon);
                        $('#maxcoupon'+data.count).html(data.couponAll);
                        if(data.couponAll<data.avgCoupons){
                            console.log("1");
                            $('#spcoupon'+data.count).attr('coupon',data.couponAll)
                            $('#spcoupon'+data.count).attr('title','-￥'+data.couponAll.toFixed(2)+data.WebConfig.finacename2);
                            $("#spcoupon"+data.count).html('-￥'+data.couponAll.toFixed(2)+data.WebConfig.finacename2);
                        }
                        else if(data.realCashCouponAll>data.avgCoupons){
                            console.log("2");
                            $('#spcoupon'+data.count).attr('coupon',data.avgCoupon)
                            $('#spcoupon'+data.count).attr('title','-￥'+data.avgCoupon+data.WebConfig.finacename2);
                            $("#spcoupon"+data.count).html('-￥'+data.avgCoupon+data.WebConfig.finacename2);
                        }
                        if(data.avgCoupons>data.couponAll){
                            console.log("3");
                            $("#spcouponli"+data.count).html('-￥'+data.couponAll.toFixed(2)+data.WebConfig.finacename2);
                        }
                        else if(data.avgCoupons<data.couponAll){
                            console.log("4");
                            $("#spcouponli"+data.count).html('-￥'+data.avgCoupon+data.WebConfig.finacename2);
                        }
                        $('#maxcashcoupon'+data.count).html(data.realCashCouponAll);
                        if(data.avgCashCoupons>data.realCashCouponAll){
                            console.log("5");
                            $('#spcashcoupon'+data.count).attr('cashcoupon',data.realCashCouponAll)
                            $('#spcashcoupon'+data.count).attr('title','-￥'+data.realCashCouponAll.toFixed(2)+data.WebConfig.finacename3);
                            $("#spcashcoupon"+data.count).html('-￥'+data.realCashCouponAll.toFixed(2)+data.WebConfig.finacename3);
                        }
                        else if(data.avgCashCoupons<data.realCashCouponAll){
                            console.log("6");
                            $('#spcashcoupon'+data.count).attr('cashcoupon',data.avgCashCoupon)
                            $('#spcashcoupon'+data.count).attr('title','-￥'+data.avgCashCoupon+data.WebConfig.finacename3);
                            $("#spcashcoupon"+data.count).html('-￥'+data.avgCashCoupon+data.WebConfig.finacename3);
                        }
                        if(data.avgCashCoupons>data.realCashCouponAll){
                            console.log("7");
                            $("#spcashcouponli"+data.count).html('-￥'+data.realCashCouponAll+data.WebConfig.finacename3);
                        }
                        else if(data.avgCashCoupons<data.realCashCouponAll){
                            console.log("8");
                            $("#spcashcouponli"+data.count).html('-￥'+data.avgCashCoupon+data.WebConfig.finacename3);
                        }
                    });
                }
            });
            $(this).parent().find(":input[type='number']").val(newval)
            numtotal();
        }
    })
    $(".myorder input[type='number']").change(function () {
        //$(this).attr('num',$(this).val());
        if(Number($(this).val())==0){
            $(this).val(1);
        }
        var numbervalue=$.trim(Number($(this).val()))==0?1:$.trim(Number($(this).val()));
        numbervalue=parseInt(numbervalue);
        if(numbervalue>=1){
            var newval = numbervalue;
            var cartId=$(this).attr('data');
            //提交
            $.ajax({
                url: '/wap/setCartNumber?shoppingId='+cartId+"&number="+newval,
                //type: 'post',
                dataType: 'json',
                contentType: 'application/json',
                async: false,
                success: function(data){
                    //console.log(JSON.stringify(data));
                    $(".putin").attr("memberSave",data.memberSave);
                    $(".putin").attr("backCashCoupon",data.backCashCoupon);
                    $(".putin").attr("freight",data.freight);
                    $(".putin").attr("realPay",data.realPay);
                    $(".putin").attr("count",data.count);
                    $(".memberSave").html('-￥'+data.memberSave.toFixed(2));
                    $(".freight").html('-￥'+data.freight.toFixed(2));
                    $(".goodtype").attr("datarealpay",data.realPay);
                    $(".goodtype").attr("datafreight",data.freight);
                    $(data.productInfo).each(function (i,item) {
                        //alert(data.avgCashCoupon);
                        $('#maxcoupon'+data.count).html(data.couponAll);
                        if(data.couponAll<data.avgCoupons){
                            console.log("1");
                            $('#spcoupon'+data.count).attr('coupon',data.couponAll)
                            $('#spcoupon'+data.count).attr('title','-￥'+data.couponAll.toFixed(2)+data.WebConfig.finacename2);
                            $("#spcoupon"+data.count).html('-￥'+data.couponAll.toFixed(2)+data.WebConfig.finacename2);
                        }
                        else if(data.realCashCouponAll>data.avgCoupons){
                            console.log("2");
                            $('#spcoupon'+data.count).attr('coupon',data.avgCoupon)
                            $('#spcoupon'+data.count).attr('title','-￥'+data.avgCoupon+data.WebConfig.finacename2);
                            $("#spcoupon"+data.count).html('-￥'+data.avgCoupon+data.WebConfig.finacename2);
                        }
                        if(data.avgCoupons>data.couponAll){
                            console.log("3");
                            $("#spcouponli"+data.count).html('-￥'+data.couponAll.toFixed(2)+data.WebConfig.finacename2);
                        }
                        else if(data.avgCoupons<data.couponAll){
                            console.log("4");
                            $("#spcouponli"+data.count).html('-￥'+data.avgCoupon+data.WebConfig.finacename2);
                        }
                        $('#maxcashcoupon'+data.count).html(data.realCashCouponAll);
                        if(data.avgCashCoupons>data.realCashCouponAll){
                            console.log("5");
                            $('#spcashcoupon'+data.count).attr('cashcoupon',data.realCashCouponAll)
                            $('#spcashcoupon'+data.count).attr('title','-￥'+data.realCashCouponAll.toFixed(2)+data.WebConfig.finacename3);
                            $("#spcashcoupon"+data.count).html('-￥'+data.realCashCouponAll.toFixed(2)+data.WebConfig.finacename3);
                        }
                        else if(data.avgCashCoupons<data.realCashCouponAll){
                            console.log("6");
                            $('#spcashcoupon'+data.count).attr('cashcoupon',data.avgCashCoupon)
                            $('#spcashcoupon'+data.count).attr('title','-￥'+data.avgCashCoupon+data.WebConfig.finacename3);
                            $("#spcashcoupon"+data.count).html('-￥'+data.avgCashCoupon+data.WebConfig.finacename3);
                        }
                        if(data.avgCashCoupons>data.realCashCouponAll){
                            console.log("7");
                            $("#spcashcouponli"+data.count).html('-￥'+data.realCashCouponAll+data.WebConfig.finacename3);
                        }
                        else if(data.avgCashCoupons<data.realCashCouponAll){
                            console.log("8");
                            $("#spcashcouponli"+data.count).html('-￥'+data.avgCashCoupon+data.WebConfig.finacename3);
                        }
                    });
                }
            });
            $(this).parent().find(":input[type='number']").val(newval)
            numtotal();
        }

        numtotal();
    })
    numtotal();
    // /!*计算数量及总价*!/
    function numtotal() {
        var totalprice =0.00;
        var totalpriceold =0.00;
        var checkgid=[];
        var total=0;
        var index=0;
        var freight=0;
        $(".myorder .goodtype").each(function () {
            var goodid=$(this).parents(".goodcon").attr('goodid');
            checkgid.push(goodid);
            var parentold = $(this).parents(".goodcon").find("input[type='number']").attr("price");
            var parent = $(this).parents(".goodcon").find("input[type='number']").attr("datarealpay");
            var num = $(this).parents(".goodcon").find("input[type='number']").val();

            totalprice += Number(parent);
            totalpriceold += Number(parentold)* Number(num);
            total +=Number(num);
            if(index==0){
                freight=$(this).parents(".goodcon").find("input[type='number']").attr("datafreight");
            }
            index++;
        })
        var totalprice = totalprice.toFixed(2)
        $(".money1").text(totalpriceold.toFixed(2));
        $(".money").text((parseFloat(totalprice)+parseFloat(freight)).toFixed(2));
        $(".totalnum").text(total);
    }

    /*下拉显示地址栏*/
    var startX =0;
    var startY =0;
    $(".myorder .main_con").on("touchstart", function (e) {
        startY = e.originalEvent.changedTouches[0].clientY;
    });
    $(".myorder .main_con").on("touchmove", function (e) {
        var moveY = e.originalEvent.changedTouches[0].clientY;
        if((moveY-startY)>0){
            if($(".myorder .fixed-bottom .bottom_address").hasClass("hide")){
                $(".myorder .fixed-bottom .bottom_address").removeClass("hide")
            }
        }
    });
    /*折扣券弹框显示隐藏*/
    // $(".myorder .quan div.arrow").on('click',function () {
    //     $(this).find(".quan_alert").fadeIn();
    // })
    // $(".myorder .quan_alert .quan_con .close").on('click',function () {
    //     $(this).parent().parent().fadeOut();
    //     return false;
    // })
    /*滑动到底部显示地址*/
    $(".main").scroll(function(){
        var $this =$(this),
            viewH =$(this).height(),//可见高度
            contentH =$(this).get(0).scrollHeight,//内容高度
            scrollTop =$(this).scrollTop();//滚动高度
        if(scrollTop/(contentH -viewH)>=0.99){ //到达底部100px时,加载新内容
            if($(".myorder .fixed-bottom .bottom_address").hasClass("hide")){
                $(".myorder .fixed-bottom .bottom_address").removeClass("hide")
            }
        }
    });

    /*商品价格*/
    function  productPriceTotal(productCount) {
        var productPrice= $('.product-price').html();
        var productPriceCount=0;
        var productPrices=0;
        if(productPrice!=null){
            productPrices= parseInt(productPrice);
        }
        productPriceCount=productPrices*productCount;
        return productPriceCount;
    }

</script>
</html>